import 'package:flutter/material.dart';

class ComplexTextField extends StatelessWidget {
  final IconData icon;
  final String labelText;
  final String prefixText;
  final String hintText;
  final double marginTop;
  final bool isObscure;
  final TextInputAction textInputAction;
  final TextInputType keyboardType;

  final FormFieldSetter<String> onSaved;
  final FormFieldValidator<String> validator;
  final TextEditingController controller;

  ComplexTextField({
    this.icon,
    this.labelText,
    this.prefixText,
    this.hintText,
    this.textInputAction,
    this.keyboardType,
    this.onSaved,
    this.validator,
    this.isObscure = false,
    this.marginTop = 5.0,
    this.controller,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.only(top: marginTop),
      padding: EdgeInsets.only(left: 40, right: 40),
      height: 45,
      child: TextField(
        controller: this.controller,
        textInputAction: this.textInputAction,
        keyboardType: this.keyboardType,
        obscureText: this.isObscure,
        onSubmitted: this.onSaved,
        decoration: InputDecoration(
          border: OutlineInputBorder(),
          focusedBorder: OutlineInputBorder(
            borderSide: BorderSide(color: Color.fromARGB(255, 44, 126, 232)),
            /*  borderRadius: BorderRadius.only(
              topLeft: Radius.circular(10),
              bottomLeft: Radius.circular(10),
            ),*/
          ),
          enabledBorder: OutlineInputBorder(
            borderSide: BorderSide(
                color: Color.fromARGB(
                    255, 173, 206, 219)), //  //255, 171, 171, 171
            /*  borderRadius: BorderRadius.only(
              topLeft: Radius.circular(10),
              bottomLeft: Radius.circular(10),
            ),*/
          ),
          prefixIcon: Icon(
            this.icon,
            color: Color.fromARGB(255, 44, 126, 232),
          ),
          prefixText: '${this.prefixText}   ',
          prefixStyle: TextStyle(color: Colors.black54, fontSize: 14),
          labelText: this.labelText,
          labelStyle: TextStyle(fontSize: 14),
          hintText: this.hintText,
          hintMaxLines: 1,
          hintStyle: TextStyle(
            color: Colors.black26,
            fontSize: 10,
          ),
          fillColor: Color(0x110099ee),
          filled: true,
        ),
      ),
    );
  }
}
